/*
 * CcExpr.h
 *
 *  Created on: 2012/05/03
 *      Author: guanxiaoying
 */

#ifndef CCEXPR_H_
#define CCEXPR_H_

#define NOT_CONSTANT   0
#define CONSTANT_VALUE 1
#define INIT_CONSTANT  2
#define VARIABLE  -1


#define EXPR_TOKEN    (0x0001)
#define EXPR_IDENTIFIER    (0x0101)
#define EXPR_CONSTANT      (0x0102)
#define EXPR_STRING        (0x0103)
#define EXPR_DECLARATION   (0x0104)
#define EXPR_STATEMENT     (0x0105)
#define EXPR_INITEXPRLIST    (0x0106)
#define EXPR_PARENTHESE    (0x0107)

#define EXPR_ARRAY         (0x0201)
#define EXPR_FUNCTIONCALL  (0x0202)
#define EXPR_MEMBER        (0x0203)
#define EXPR_PTRMEMBER     (0x0204)
#define EXPR_POSTINC       (0x0205)
#define EXPR_POSTDEC       (0x0206)
#define EXPR_COMPOUNDLITERALS     ( 0x0207 )

#define EXPR_PREINC       (0x0301)
#define EXPR_PREDEC       (0x0302)
#define EXPR_ADDRESS    (0x0303)
#define EXPR_ASTERISK   (0x0304)
#define EXPR_PLUS       (0x0305)
#define EXPR_MINUS      (0x0306)
#define EXPR_NEGATION   (0x0307)
#define EXPR_BIT_NEGATION (0x0308 )
#define EXPR_SIZEOF       (0x0309)
#define EXPR_CAST         (0x030A)

#define EXPR_MUL          (0x0401)
#define EXPR_DIV          (0x0402)
#define EXPR_MOD          (0x0403)

#define EXPR_ADD           (0x0501)
#define EXPR_SUB           (0x0502)

#define EXPR_LEFTSHIFT     (0x0601)
#define EXPR_RIGHTSHIFT    (0x0602)

#define EXPR_GREATER          (0x0701)
#define EXPR_GREATEREQU       (0x0702)
#define EXPR_LESS          (0x0703)
#define EXPR_LESSEQU       (0x0704)

#define EXPR_EQUAL         (0x0801)
#define EXPR_UNEQUAL       (0x0802)

#define EXPR_BIT_AND       (0x0901)

#define EXPR_BIT_EXOR      (0x0A01)

#define EXPR_BIT_INOR      (0x0B01)

#define EXPR_LOGIC_AND     (0x0C01)

#define EXPR_LOGIC_OR      (0x0D01)

#define EXPR_CONDITION     (0x0E01)
#define EXPR_COLON		   (0x0E02)

#define EXPR_ASSIGN        (0x0F01)
#define EXPR_MUL_ASSIGN    (0x0F02)
#define EXPR_DIV_ASSIGN    (0x0F03)
#define EXPR_MOD_ASSIGN    (0x0F04)
#define EXPR_ADD_ASSIGN    (0x0F05)
#define EXPR_SUB_ASSIGN    (0x0F06)
#define EXPR_LSHT_ASSIGN   (0x0F07)
#define EXPR_RSHT_ASSIGN   (0x0F08)
#define EXPR_BITAND_ASSIGN (0x0F09)
#define EXPR_BITEXOR_ASSIGN (0x0F0A)
#define EXPR_BITINOR_ASSIGN (0x0F0B)

#define EXPR_COMMA    (0x1001)
#define EXPR_ARG      (0x1002)

#define CcExpIsConstantValue( expr )  ( (CONSTANT_VALUE == stExpressionAccess.constFlg.get(expr) ) \
		&& ( 0 != stExpressionAccess.constValue.get(expr ) ))

AST  CcExpression( U4 *, U2, AST );
AST  CcConstantExpression( U4 *, U2, AST );
BOOL CcExprIsNullPointer( AST  astNode );
#endif /* CCEXPR_H_ */
